# ##########################################
#	Setup some generics for the library:
SET( LIB_NAME "Core" )
SET( LIB_UNAME "CORE" )

# Locations in the IDE project to place the
# library and tests.
SET( LIB_FOLDER "Libraries" )
SET( TEST_FOLDER "UnitTests" )


# ##########################################
#	List include files here.
SET( INCLUDE_FILES
	Include/Core/Config.hpp
	Include/Core/Core.hpp
)


# ##########################################
#	List source files here.
SET( SOURCE_FILES
	Source/Core.cpp
)

# Some utility files.
SET( UTILITY_FILES
	../../Config.hpp.in
	../CMakeLists.txt
)

# ##########################################
#	List test files here.
SET( TEST_FILES
	Tests/TestAll.hpp
)


# ##########################################
#	No modifications needed past this point.
# ##########################################
# ##########################################
# Set file groupings here.
SOURCE_GROUP( "Includes" FILES ${INCLUDE_FILES} )
SOURCE_GROUP( "Source" FILES ${SOURCE_FILES} )
SOURCE_GROUP( "Utilities" FILES ${UTILITY_FILES} )


# ##########################################
#	Create the library.
ADD_LIBRARY( Core
	STATIC
	${INCLUDE_FILES}
	${SOURCE_FILES}
	${UTILITY_FILES}
)

# ##########################################
#	Set the new target usage requirements.
#	Requires CMake 2.8.11.
TARGET_COMPILE_DEFINITIONS( Core
	PRIVATE		BUILDING_CORE
)
TARGET_INCLUDE_DIRECTORIES( Core
	PUBLIC		${CMAKE_CURRENT_LIST_DIR}/Include
)
TARGET_LINK_LIBRARIES( Core
	GFlags
	GLog
	${CMAKE_THREAD_LIBS_INIT}
)


# ##########################################
# Group the libraries.
SET_PROPERTY( TARGET ${LIB_NAME} PROPERTY FOLDER ${LIB_FOLDER} )


# ##########################################
# Make a unit test holder for the Math library.
IF( BUILD_UNIT_TESTS )
	ADD_EXECUTABLE( _Test${LIB_NAME}
		Tests/Main.cpp
		${TEST_FILES}
	)
	TARGET_LINK_LIBRARIES( _Test${LIB_NAME} ${LIB_NAME} GMock )

	ADD_TEST( NAME _Test${LIB_NAME} COMMAND _Test${LIB_NAME} )

	# ##########################################
	# Group the tests.
	SET_PROPERTY( TARGET _Test${LIB_NAME} PROPERTY FOLDER ${TEST_FOLDER} )
ENDIF( BUILD_UNIT_TESTS )
